package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BaseShopMapper;
import com.ruoyi.system.domain.BaseShop;
import com.ruoyi.system.service.IBaseShopService;

/**
 * 门店Service业务层处理
 *
 * @author ruoyi
 * @date 2025-01-16
 */
@Service
public class BaseShopServiceImpl implements IBaseShopService
{
    @Autowired
    private BaseShopMapper baseShopMapper;

    /**
     * 查询门店
     *
     * @param shopId 门店主键
     * @return 门店
     */
    @Override
    public BaseShop selectBaseShopByShopId(Long shopId)
    {
        return baseShopMapper.selectBaseShopByShopId(shopId);
    }

    /**
     * 查询门店列表
     *
     * @param baseShop 门店
     * @return 门店
     */
    @Override
    @DataScope(deptAlias = "u", userAlias = "u")
    public List<BaseShop> selectBaseShopList(BaseShop baseShop)
    {
        return baseShopMapper.selectBaseShopList(baseShop);
    }

    /**
     * 新增门店
     *
     * @param baseShop 门店
     * @return 结果
     */
    @Override
    public int insertBaseShop(BaseShop baseShop)
    {
        baseShop.setCreateTime(DateUtils.getNowDate());
        return baseShopMapper.insertBaseShop(baseShop);
    }

    /**
     * 修改门店
     *
     * @param baseShop 门店
     * @return 结果
     */
    @Override
    public int updateBaseShop(BaseShop baseShop)
    {
        baseShop.setUpdateTime(DateUtils.getNowDate());
        return baseShopMapper.updateBaseShop(baseShop);
    }

    /**
     * 批量删除门店
     *
     * @param shopIds 需要删除的门店主键
     * @return 结果
     */
    @Override
    public int deleteBaseShopByShopIds(Long[] shopIds)
    {
        return baseShopMapper.deleteBaseShopByShopIds(shopIds);
    }

    /**
     * 删除门店信息
     *
     * @param shopId 门店主键
     * @return 结果
     */
    @Override
    public int deleteBaseShopByShopId(Long shopId)
    {
        return baseShopMapper.deleteBaseShopByShopId(shopId);
    }
}
